<script setup>
 
function myfunction(){
    alert("Hello World");
}

function myfunction2(var1,var2){
    alert("Hello World2"+var1+var2);
}

const myfunction3 = function(){
    alert("Hello World3");
}

const arrowfunction = ()=>{
    alert("arrow function,Hello World");
}

const arrowfunction2 = (var1,var2)=>{

    alert("Hello World2，"+var1+" + "+var2+" sum:"+sum(var1,var2));
}

const arrowfunction3 = (var1,var2)=>
    alert("Hello World2"+var1+var2)

const sum = (var1,var2) => var1+var2

const arrfilter = ()=>{
    let numbers = [1, 2, 3, 4, 5, 6, 7, 8];
    let arr1 = numbers.filter(num=>num >= 5)
    alert(arr1)

    let arr2 = numbers.filter(function(num) {
        return num >= 5
    });
    alert(arr2)
}
</script>
<template>
    <h3>function</h3>
    <button @click="myfunction">myfunction</button>
    <button @click="myfunction2('a','b')">myfunction2</button>
    <button @click="myfunction3">myfunction3</button>
    <h3>arrow function</h3>
    <button @click="arrowfunction">arrowfunction</button>
    <button @click="arrowfunction2(7,8)">arrowfunction2</button>
    <button @click="arrowfunction3('a','2')">arrowfunction3</button>
    <h3>array.filter</h3>
    <button @click="arrfilter">arrowfunction3</button>
</template>